<template>
  <div @click="toTaobao(item.goodId)" class="list_item">
    <div class="imgBox">
      <a href="javascript:void (0)">
        <img class="" v-lazy="item.mainPic">
        <span v-show="item.iconForIOS"  class="new_icon" :style="{backgroundImage:`url(${item.iconForIOS})`}"></span>
      </a>
    </div>
    <div class="quan_item_con">
      <div class="item-title">{{item.name}}</div>
      <div class="price clearfix">
        <div class="fl"><span class="pir">¥</span><span class="num">{{item.priceAfterCoupon | getCount}}</span><span class="pri_font">券后价</span>
        </div>
        <span class="list fr">{{item.couponUse}}人已领</span>
      </div>
      <div class="item_btn_box flex-row flex-y-center">
        <div class="flex-grow-1">
          <span>领{{item.couponValue | getCount}}元券</span>
        </div>
        <a class="quan_button flex-grow-0" href="javascript:void (0)">领券抢购</a>
      </div>
    </div>
  </div>
</template>
<script>
  import {GETCHANGELINK } from 'src/const/uri';
  export default{
    props:{
      item:{type:Object,default:{}}
    },
    methods:{
      toTaobao(item){
          console.log(item);
          this.$ajax.get(GETCHANGELINK,{
              goodId: item,
              promotionTypeId: 1
          },(res)=>{
              window.open(res.data.tbkCouponLink);
          });
        //window.open(item);
      }
    }
  }
</script>
<style lang="less">
  .list_item{
    position: relative;
    width: 265px;
    height: 398px;
    margin-bottom: 15px;
    background-color: #fff;
    -webkit-transition: border .6s;
    -ms-transition: border .6s;
    -o-transition: border .6s;
    transition: border .6s;
    border: 2px solid #f5f5f5;
    cursor: pointer;
    &:hover{
      border: 2px solid #f54e54;
    }
    .imgBox{
      >a{
        >img {
          width:261px;
          height:261px;
        }
        .new_icon{
          position: absolute;
          top: 0px;
          left: 0px;
          display: block;
          width: 40px;
          height: 20px;
          background-repeat:no-repeat;
          background-size:100% 100%;
          background-position:center center;
        }
      }
    }
    .quan_item_con{
      padding: 0 10px 11px 10px;
      .item-title{
        padding: 5px 0 2px 0;
        font-size: 14px;
        overflow: hidden;
        word-break: keep-all;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .price{
        margin-top: 22px;
        color: #f24f60;
        height: 30px;
        >.fl{
          .pir{
            font-size: 12px;
            color:@themeColor;
          }
          .num{
            margin-left: 3px;
            line-height: 30px;
            font-size: 26px;
            font-family: arial;
            position: relative;
            top: 1px;
          }
          .pri_font{
            padding: 0 12px 0 3px;
            color: #a6a4b2;
          }
        }
        >.list{
          margin-top: 10px;
          color: #a6a4b2;
        }
      }
      .item_btn_box{
        margin-top: 10px;
        span{
          padding: 1px 5px;
          color: #808080;
          border: 1px solid #ccc;
          border-radius: 2px;
          vertical-align: middle;
        }
        .quan_button{
          display: inline-block;
          width: 80px;
          line-height: 32px;
          height: 32px;
          font-size: 14px;
          color: #fff;
          background-color: #f54e54;
          text-align: center;
          border-radius: 3px;
        }
      }
    }
  }
</style>
